Method for converting image from low resolution into high resolution

ABSTRACT

A method of scaling up an image. The method converts a source image with M*N pixels into a target image with KM*HN pixels and includes the steps of: choosing a pixel from the source image as a processing pixel; analyzing the character of the processing pixel according to values of a plurality of pixels neighboring the processing pixel, and choosing a tilt pattern as a characteristic pattern; calculating a pixel compensation matrix according to the characteristic pattern, the pixel value of the processing pixel, and the values of the pixels neighboring the processing pixel; calculating K*H target pixel values as the target image according to the pixel value of the processing pixel and its corresponding pixel compensation matrix; and repeating the above-mentioned steps until all the pixels of the source image are processed.

This application claims the benefit of the filing date of Taiwan Application Ser. No. 092130173, filed on Oct. 30, 2003, the content of which is incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The invention relates to an image processing method, and more particularly to a method for scaling up an image.

2. Description of the Related Art

The video technology has been widely used in various electrical products. Generally speaking, when the compression/decompression modules utilize the standard video encoder/decoder, such as JPEG, MPEG, MPEG-2, MPEG-4, H.263, H.264, and the like, to process the image frame, the modules have to store the image data in the memory temporarily or permanently for the processing necessity.

However, in the system having ultra-large frame and ultra-high frame rates, the frame consumes a lot memory space and the system bus bandwidth, and thus tends to increase the system loading. For example, in a HDTV (High-Definition Television), each frame needs the memory space for 1920*1088*1.5=3.13 Mbytes, wherein 1920*1088 is the frame resolution.

Because the resolution of the frame of HDTV can reach 1920×1088, two problems should be considered. The first problem is that the memory required by the system is too large. The second problem is that the bandwidth consumed by the data transmission of the system is too large. In order to reduce the consumption of the bandwidth and the memory space without changing the architecture of the conventional decoder, the frame data should be compressed before the data is written in the memory or inputted to the bus, and returned to the original condition after the data is read or before the data is inputted to the micro-controller. Hence, the memory space and the transmission bandwidth can be reduced by using the compression unit and decompression unit.

FIG. 1 is a diagram showing that four points are compressed into one point. Some simple compression methods in the pixel domain will be described in the following.

1. Average of four points: four points in a 2×2 block of FIG. 1 are averaged into a point as the compression value of four points. That is, ${y\left( {m,n} \right)} = {\frac{1}{4}{\sum\limits_{k = 0}^{1}{\sum\limits_{h = 0}^{1}{{x\left( {{i + h},{j + k}} \right)}.}}}}$

2. Take the point at the upper-left corner: the upper-left point of the block is directly taken as the compression value of the four points. That is, y(m,n)=x(i,j).

If the compression value is going to be returned to the original shape, one of the following methods may be applied.

1. Duplicate into four points: the four points in the block use duplicated average.

2. Bilinear interpolation: take a linear interpolation of two adjacent points to obtain the value of the point between the two adjacent points.

It is known in the art that the frame compression and decompression methods greatly influence the frame quality. The designer needs to choose a proper method so as to prevent the frame quality from deterioration.

SUMMARY OF THE INVENTION

It is therefore an object of the invention to provide a method for scaling up an image without consuming a lot of memory space.

An object of the invention is to provide a method for scaling up an image without consuming a lot of transmission bandwidth.

An object of the invention is to provide a method for scaling up an image without greatly deteriorating image quality.

To achieve the above-mentioned object, the invention provides a method for scaling up an image. The method scales up a source image (low-resolution image) with the resolution of M*N to a target image (high-resolution image region) with the resolution of KM*HN. The method includes the steps of: choosing a pixel from a source image as a processing pixel; analyzing the characteristic of the processing pixel according to the values of a plurality of neighboring pixels close to the processing pixel and choosing a tilt pattern as a characteristic pattern; generating a pixel compensation matrix according to the characteristic pattern, the value of the processing pixel, and the values of the neighboring pixels; generating K*H target pixels as the target image according to the value of the processing pixel and the pixel compensation matrix; and repeating the above-mentioned steps until all of the pixels of the source image are processed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram showing that a high-resolution image with 2×2 points is compressed into one point.

FIG. 2 is a diagram showing that an original pixel point P is scaled up to 2×2 points.

FIG. 3 shows a flow chart showing the method of the invention for scaling up an image.

FIG. 4 shows five possible tilt patterns after the original pixel point is scaled up.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 2 is a diagram showing that an original pixel point P is scaled up to 2×2 target pixel points P[1], P[2], P[3], and P[4] according to a embodiment of the invention. The original pixel point P is defined as a processing pixel and chosen from a source image region. On the source image region, the processing pixel P has eight neighboring pixel points, which are the points (A˜H) having the pixel values A to H, respectively.

FIG. 3 shows a flow chart showing an embodiment of the method of the invention for scaling up an image. The steps of the method of the present invention will be described with reference to FIG. 2, FIG. 3, and FIG. 4.

Step S302: Choose a pixel from the source image region as the processing pixel P.

Step S304: Analyze the characteristic according to the values of the neighboring pixels close to the processing pixel P and choose a characteristic pattern. The characteristic analyzing is performed to determine the tilt direction of the values of the neighboring pixels. In general, the tilt direction is substantially divided into a vertical direction, a horizontal direction, and two diagonal directions. Hence, the tilt direction of the target pixels is obtained by the characteristic analyzing procedure. Please refer to FIG. 4, wherein FIG. 4(a) shows the vertical tilt direction, FIG. 4(b) shows the horizontal tilt direction, FIG. 4(c) shows the left-to-right diagonal tilt direction, FIG. 4(d) shows the right-to-left diagonal tilt direction, and FIG. 4(e) shows the smooth pattern.

To determine which characteristic pattern match the pixel values of the target image region being scaled up, the following weighted summation procedures may be used to calculate eight weighted pixel values (v_(A) to v_(H)). v _(A)=2A+B+D v _(B)=2B+A+C v _(C)=2C+B+E v _(D)=2D+A+F v _(E)=2E+C+H v _(F)=2F+D+G v _(G)=2G+F+H v _(H)=2H+E+G

wherein v_(A) to v_(H) represent the weighted value around the processing pixel P in eight directions. For example, v_(A) represents the value corresponding to the upper-left direction.

Next, the tilt direction is determined according to v_(A) to v_(H). Usually, the pixel values at two opposite sides along the tilt direction are quite different. That is, the larger the difference between the pixel values in one direction, the more likely the direction being the tilt direction. The tilt direction may be determined according to the following equations: d ₀ =v _(D) −v _(E) d ₁ =v _(B) −v _(G) d ₂ =v _(C) −v _(F) d ₃ =v _(A) −v _(H) dir=arg max_(i) {|d_(i)|}

wherein “dir” is the direction value of the tilt direction. That is, when d₀ is the maximum among d_(i), the characteristic pattern is the horizontal characteristic pattern; when d₁ is the maximum among d_(i), the characteristic pattern is the vertical characteristic pattern; when d₂ is the maximum among d_(i), the characteristic pattern is the positive-slope tilt characteristic pattern; and when d₃ is the maximum among d_(i), the characteristic pattern is the negative-slope tilt characteristic pattern. Accordingly, a characteristic pattern may be chosen according to the direction value dir.

Step S306: Identify whether or not the characteristic pattern meets the above-mentioned assumption which indicates that the value of the processing pixel P ranges between the high point and low point in the tilt direction. This assumption must be correct so as to avoid the error tilt. In other words, it is possible check whether or not the original pixel value and its corresponding neighboring pixel values in the tilt direction satisfy the assumption. For example, if the up and down points in the tile direction are D and E, then D, E and P must satisfy the following relationship: D≦P≦E or D≧P≧E

If the above-mentioned relationship is not satisfied, it means that the position of the processing pixel P does not correspond to the assumption of the tilt direction. At this time, it is possible to assume that the 2×2 block including four points P[1], P[2], P[3], and P[4] is a smooth pattern, or choose a tilt direction corresponding to a second large direction value dir as the characteristic pattern and repeating the identifying procedure. The equations for identifying various direction values dir are as follows: dir=0D≦P≦E or E≦P≦D dir=1B≦P≦G or G≦P≦B dir=2C≦P≦F or F≦P≦C dir=3A≦P≦H or H≦P≦A

Step S308: Calculate the pixel compensation matrix. If the direction value dir and the processing pixel P match the above-mentioned conditions, the tilt direction assumption is satisfied and the procedure of calculating the compensation matrix of the tilt direction may be started. In this embodiment, if the compression method represents that four points are compressed into one point, the value of the processing pixel P and the values A to H of the neighboring pixels may be used to generate the p[0:3]. That is, p[i] = f_(i)(A, B, …  , H, P) + P, i = 0 ∼ 3 $\begin{matrix} \quad \\ {P = {\begin{bmatrix} {p\lbrack 0\rbrack} & {p\lbrack 1\rbrack} \\ {p\lbrack 2\rbrack} & {p\lbrack 3\rbrack} \end{bmatrix} = {\begin{bmatrix} {f_{0}\left( {A,\ldots\quad,H,P} \right)} & {f_{1}\left( {A,\ldots\quad,H,P} \right)} \\ {f_{2}\left( {A,\ldots\quad,H,P} \right)} & {f_{3}\left( {A,\ldots\quad,H,P} \right)} \end{bmatrix} + {P\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}}}}} \\ \quad \end{matrix}$

wherein f_(i)(A,B, . . . ,H,P) represents the compensation matrix. In this embodiment, the forms of f₀ to f₃ may be simplified by an exact matrix set and an exact function set. The exact matrix set and the exact function set may be determined according to the tilt direction. First, a plurality of 2 by 2 matrixes may be chosen as the exact matrix set S. In addition, several functions are chosen to be the exact function set U. Each element β in S corresponds to a function g_(i)(A, . . . ,H,P) in the set U. P[i] is a multiple of one of the elements β, and the multiple is g_(i)(A, . . . ,H,P). That is, the pixel value of the processing pixel P and the values of the corresponding neighboring pixels are substituted into the corresponding exact function set U to generate a plurality of scalar values. Thereafter, these scalar values are respectively multiplied by its corresponding exact matrix S so as to obtain the following compensation values of pixel (referred to as P₁). ${S = \left\{ {\beta_{0},\ldots\quad,\beta_{N - 1}} \right\}},{U = \left\{ {{\left\{ {g_{0}\left( {A,\ldots\quad,H,P} \right)} \right\}{\exists i}},{\beta_{i} \in},{\left. {g_{i} \in U}\Rightarrow{P\lbrack i\rbrack} \right. = {{{g_{i}\left( {A,\ldots\quad,H,P} \right)} \times \beta_{i}} = {{g_{i}\left( {A,\ldots\quad,H,P} \right)} \times \begin{bmatrix} \beta_{i,0} & \beta_{i,1} \\ \beta_{i,2} & \beta_{i,3} \end{bmatrix}}}}} \right.}$

For example, the set S may be chosen as: $S{\left\{ {\begin{bmatrix} 1 & {- 1} \\ 1 & {- 1} \end{bmatrix},\begin{bmatrix} 1 & 1 \\ {- 1} & {- 1} \end{bmatrix},\begin{bmatrix} 0 & 1 \\ {- 1} & 0 \end{bmatrix},\begin{bmatrix} 1 & 0 \\ 0 & {- 1} \end{bmatrix}} \right\}.}$

The corresponding function set U is: U = {g₀, g₁, g₁, g₃} $g_{0} = \frac{\left( {B + E} \right) - \left( {D + G} \right)}{8}$ $g_{1} = \frac{\left( {B + D} \right) - \left( {E + G} \right)}{8}$ $g_{2} = \frac{\left( {{2D} + A + F} \right) - \left( {{2E} + C + H} \right)}{16}$ $g_{3} = \frac{\left( {{2B} + A + C} \right) - \left( {{2G} + F + H} \right)}{16}$

wherein the exact matrix set S and the exact function set U are defined in advance. Thereafter, the corresponding exact matrix and exact function are chosen according to the tilt direction. That is, a proper exact matrix and function may be selected according to the actual condition so that the optimum adjustment may be made.

Step S310: Calculate the target pixel value. A plurality of target pixel values are obtained by adding the pixel value of the processing pixel and its corresponding pixel compensation matrix together. A target image may be obtained by properly placing the target pixel into the source image. The target image is the scaled up source image.

Step S312: Identify whether or not the method is finished. The above-mentioned steps are repeated until all pixels to be processed are processed.

While certain exemplary embodiments have been described and shown in the accompanying drawings, it is to be understood that such embodiments are merely illustrative of and not restrictive on the broad invention, and that this invention not be limited to the specific construction and arrangement shown and described, since various other modifications may occur to those ordinarily skilled in the art. 

1. A method for scaling up an image, the method converting a source image with M*N pixels into a target image with KM*HN pixels, wherein M, N, K and H are integers and the method comprises the following steps: choosing one pixel from the source image as a processing pixel; determining a characteristic pattern according to the processing pixel and a plurality of neighboring pixels close to the processing pixel in the source image; generating a pixel compensation matrix according to the characteristic pattern; generating K*H target pixels according to a pixel value of the processing pixel and the pixel compensation matrix; and repeating the above-mentioned steps until all pixels of the source image are processed.
 2. The method according to claim 1, wherein the step of determining the characteristic pattern further comprises: performing a characteristic analyzing procedure according to the processing pixel and the neighboring pixels, so as to determine the characteristic pattern.
 3. The method according to claim 2, wherein the step of performing the characteristic analyzing procedure comprises: performing a weighted summation procedure to generate a plurality of weighted pixel values according to the processing pixel and the neighboring pixels.
 4. The method according to claim 3, wherein the step of performing the characteristic analyzing procedure further comprises the steps of: determining a characteristic direction according to the plurality of weighted pixel values and a plurality of tilt condition equations; and determining an exact matrix and an exact function according to the characteristic direction.
 5. The method according to claim 4, wherein the step of generating the pixel compensation matrix further comprises; substituting the pixel value of the processing pixel and the values of the neighboring pixels into the exact function, so as to generate a scalar value; and multiplying the scalar value by the exact matrix, so as to obtain the pixel compensation matrix.
 6. The method according to claim 1, wherein the step of determining the characteristic pattern further comprises: checking whether or not the value of the processing pixel and the values of the neighboring pixels match the characteristic pattern through utilizing a plurality of conditional equations.
 7. The method according to claim 1, wherein the step of generating the pixel compensation matrix further comprises: substituting the value of the processing pixel and the values of the neighboring pixels into an exact function, so as to generate a value; and multiplying the scalar value by an exact matrix, so as to obtain the pixel compensation matrix.
 8. A method for converting a source pixel into a plurality of target pixels, comprising the following steps: determining a compensation pixel value according to the source pixel and at least one neighboring pixel close to the source pixel; and generating the plurality of target pixels according to the source pixel and the compensation pixel value.
 9. The method according to claim 8, wherein the compensation pixel value is determined according to a plurality of predetermined patterns.
 10. The method according to claim 9, wherein the plurality of predetermined patterns includes a vertical tilt pattern, a horizontal tilt pattern, a left-to-right tilt pattern, a right-to-left tilt pattern, and a smooth pattern.
 11. The method according to claim 8, wherein the step of determining the compensation pixel value flintier comprises: generating a plurality of weighted pixel values according to the source pixel and the neighboring pixel; and determining the compensation pixel value according to the weighted pixel values.
 12. The method according to claim 11, wherein the step of determining the compensation pixel value further comprises: determining an exact matrix and an exact function according to the weighted pixel values and a plurality of tilt condition equations; and determining the compensation pixel value by utilizing the exact matrix and the exact function.
 13. The method according to claim 11, wherein the step of determining the compensation pixel value further comprises: determining a tilt direction according to the weighted pixel values and a plurality of tilt condition equations; and determining the compensation pixel value according to the tilt direction.
 14. The method according to claim 8, wherein the step of determining the compensation pixel value further comprises: substituting the source pixel and the neighboring pixel into an exact function to generate a scalar value; and multiplying the scalar value by an exact matrix, so as to obtain the pixel compensation value.
 15. A method for scaling up an source image, comprising the following steps: determining a characteristic pattern according to a processing pixel selected from the source image and a plurality of neighboring pixels close to the processing pixel; generating a pixel compensation value according to the characteristic pattern; and generating a plurality of target pixels according to the processing pixel and the pixel compensation value.
 16. The method according to claim 15, wherein the characteristic pattern is selected from the patterns comprising a vertical tilt pattern, a horizontal tilt pattern, a left-to-right tilt pattern, a right-to-left tilt pattern, and a smooth pattern.
 17. The method according to claim 15, wherein the step of generating the compensation pixel value further comprises; generating a plurality of weighted pixel values according to the source pixel and the neighboring pixels; and determining the compensation pixel value according to the weighted pixel values.
 18. The method according to claim 17, wherein the step of determining the compensation pixel value further comprises: determining an exact matrix and an exact function according to the weighted pixel values and a plurality of tilt condition equations; and substituting the value of the source pixel and the values of the neighboring pixels into the exact matrix and the exact function, so as to determine the compensation pixel value.
 19. The method according to claim 17, wherein the step of determining the compensation pixel value further comprises: determining a tilt direction according to the weighted pixel values and a plurality of tilt condition equations; and determining the compensation pixel value according to the tilt direction.
 20. The method according to claim 15, wherein the step of determining the compensation pixel value further comprises: substituting the source pixel and the neighboring pixel into an exact function to generate a scalar value; and multiplying the scalar value by an exact matrix, so as to obtain the pixel compensation value. 